home *** CD-ROM | disk | FTP | other *** search
/ Celestin Apprentice 2 / Apprentice-Release2.iso / Source Code / C / Utilities / DVIM72-Mac 1.9.6 / source / set_char, fntnm, rule.c < prev    next >
Encoding:
C/C++ Source or Header  |  1992-09-14  |  3.0 KB  |  118 lines  |  [TEXT/R*ch]

  1. /**********************************************************************/
  2. /****************************** setchar *******************************/
  3. /**********************************************************************/
  4. #include <ctype.h>
  5. #include "dvihead.h"
  6. #include "commands.h"
  7. #include "gendefs.h"
  8. #include "gblprocs.h"
  9. #include "m72.h"
  10. #include "egblvars.h"
  11. #include "mac-specific.h"
  12.  
  13. void
  14. setchar(c, update_h)
  15. register BYTE c;
  16. register BOOLEAN update_h;
  17. {
  18.     register struct char_entry *tcharptr;  /* temporary char_entry pointer */
  19.  
  20.     if (DBGOPT(DBG_SET_TEXT))
  21.     {
  22.     (void)printf("setchar('");
  23.     if (isprint(c))
  24.         (void)printf("%c",c);
  25.     else
  26.         (void)printf("\\%03o",(int)c);
  27.     (void)printf("'<%d>) (hh,vv) = (%ld,%ld) font name <%s>",
  28.         (int)c, (long)hh, (long)vv, fontptr->n);
  29.     printf("\n");
  30.     }
  31.  
  32.     tcharptr = &(fontptr->ch[c]);
  33.     if (((hh - tcharptr->xoffp + tcharptr->pxlw) <= XSIZE)
  34.     && (hh >= 0)
  35.     && (vv <= YSIZE)
  36.     && (vv >= 0))
  37.     {                /* character fits entirely on page */
  38.         moveto( hh, (COORDINATE)(YSIZE-vv));
  39.         dispchar(c);
  40.         if (g_abort_dvi)
  41.             return;
  42.     }
  43.     else if (DBGOPT(DBG_OFF_PAGE) && !quiet)
  44.     {                /* character is off page -- discard it */
  45.     (void)printf(
  46.         "setchar(): Char %c [10#%3d 8#%03o 16#%02x] off page.",
  47.         isprint(c) ? c : '?',c,c,c);
  48.     printf("\n");
  49.     }
  50.  
  51.     if (update_h)
  52.     {
  53.     hxxxx += (INT32)tcharptr->tfmw;
  54.     hh += (COORDINATE)tcharptr->pxlw;
  55.     hh = (COORDINATE)(fixpos(hh-lmargin,hxxxx,conv) + lmargin);
  56.     }
  57. }
  58.  
  59. /**********************************************************************/
  60. /****************************** setfntnm ******************************/
  61. /**********************************************************************/
  62. void
  63. setfntnm(k)
  64. register INT32 k;
  65.  
  66. /***********************************************************************
  67. This routine is used to specify the  font to be used in printing  future
  68. characters.
  69. ***********************************************************************/
  70.  
  71. {
  72.     register struct font_entry *p;
  73.  
  74.     p = hfontptr;
  75.     while ((p != (struct font_entry *)NULL) && (p->k != k))
  76.         p = p->next;
  77.     if (p == (struct font_entry *)NULL)
  78.     {
  79.         (void)sprintf(message,"setfntnm():  font %ld undefined", k);
  80.         Kill_dvi(message);
  81.     }
  82.     else
  83.         fontptr = p;
  84.  
  85. #if    (HPJETPLUS | POSTSCRIPT | IMPRESS | CANON_A2)
  86.     font_switched = TRUE;
  87. #endif
  88.  
  89. }
  90.  
  91. /**********************************************************************/
  92. /****************************** setrule *******************************/
  93. /**********************************************************************/
  94. void
  95. setrule(height, width, update_h)
  96. register UNSIGN32 height, width;
  97. register BOOLEAN update_h;
  98.  
  99. {   /* draw a rule with bottom left corner at (h,v) */
  100.  
  101.     if ((height > 0) && (width > 0))        /* non-empty rule */
  102.  
  103. #if    BBNBITGRAPH
  104.     fillrect(hh+xscreen, YSIZE-vv+yscreen,
  105.         rulepxl(width,conv)  ,  rulepxl(height,conv));
  106. #else
  107.     fillrect(hh, YSIZE-vv,
  108.         rulepxl(width,conv), rulepxl(height,conv));
  109. #endif
  110.  
  111.     if (update_h)
  112.     {
  113.     hxxxx += (INT32)width;
  114.     hh += rulepxl(width, conv);
  115.     hh = fixpos(hh-lmargin,hxxxx,conv) + lmargin;
  116.     }
  117. }
  118.